<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>制定安全配置单</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/bootstraptable/bootstrap-table.css" rel="stylesheet">
</head>
<body>
<div style="color: #0e9aef;margin: 20px;">您正在做的业务是：库存管理--安全库存配置管理--制定安全库存配置单</div>

<div class="container">
    <div style="text-align: right" id="storage_btn">
        <button type="button" class="btn btn-default" id="sure_btn">确定</button>
        <button type="button" class="btn btn-default" onclick="javascript:history.back()">返回</button>
    </div>
    <div class="panel panel-default" style="margin-top: 5px;">
        <div class="page-heading">
            <div class="panel-title">
                <h2 style="text-align: center;margin-top: 30px;">安全库存配置单</h2>
            </div>
        </div>
        <div class="panel-body">
            <form class="form-horizontal" id="storage_addCell_form">
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品名称：</label>
                        <div class="col-md-6">
                            <input type="text" class="form-control" readonly style="border: none;background-color: white" name="productName" id="productName">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="control-label col-md-4">产品编号：</label>
                        <div class="col-md-6">
                            <input type="text" class="form-control" readonly style="border: none;background-color: white" name="productId" id="productId">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">库存报警下限数：</label>
                        <div class="col-md-6">
                            <input type="text" style="border: none;border-bottom: 1px solid black;" name="minAmount" id="minAmount">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">库存报警上限数：</label>
                        <div class="col-md-6">
                            <input type="text" style="border: none;border-bottom: 1px solid black;" name="maxAmount" id="maxAmount">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">最大存储量：</label>
                        <div class="col-md-6">
                            <input type="text" style="border: none;border-bottom: 1px solid black;" name="maxCapacityAmount" id="maxCapacityAmount">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">登记人：</label>
                        <div class="col-md-6">
                            <input type="text" style="border: none;border-bottom: 1px solid black;" name="register" id="register">
                        </div>
                    </div>
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">登记时间：</label>
                        <div class="col-md-6">
                            <input type="text" class="form-control" style="border: none;background-color: white" readonly name="registerTime" id="registerTime">
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-6">
                        <label class="col-md-4 control-label">配置要求：</label>
                        <div class="col-md-8">
                           <textarea style="resize: none" rows="3" cols="80" class="form-control" name="config" id="config">
                           </textarea>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4"></script>
<script src="/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="/js/hAdmin.js?v=4.1.0"></script>
<script src="/js/currentTime.js"></script>

<!-- 第三方插件 -->
<script src="/js/plugins/pace/pace.min.js"></script>

<!--BootstrapTable-->
<script src="/bootstraptable/bootstrap-table.min.js"></script>
<script src="/bootstraptable/locale/bootstrap-table-zh-CN.min.js"></script>

<script>
    $(function (){
        let id=localStorage.getItem("id")
        $("#storage_addCell_form #registerTime").val(add(fortime()))
        $.post("/design/file/getMaterialOne", {"id": id}, function (res) {
            $("#storage_addCell_form #productId").val(res.productId)
            $("#storage_addCell_form #productName").val(res.productName)
        })
        $("#storage_addCell_form #maxAmount").change(function (){

             let min = $("#storage_addCell_form #minAmount").val()
             let max = $("#storage_addCell_form #maxAmount").val()
            // alert(min)
            // alert(max)
            if(min>max){
                alert("库存报警下限数不能大于库存报警上限数")
                return
            }
        })
        $("#storage_addCell_form #maxCapacityAmount").change(function (){
            if($("#storage_addCell_form #maxAmount").val()>$("#storage_addCell_form #maxCapacityAmount").val()){
                alert("库存报警上限数不能大于最大存储量")
                return
            }
        })
        $("#storage_btn #sure_btn").click(function (){
            let minAmount=$("#storage_addCell_form #minAmount").val()
            let maxAmount=$("#storage_addCell_form #maxAmount").val()
            let maxCapacityAmount=$("#storage_addCell_form #maxCapacityAmount").val()
            if(minAmount==""){
                alert("请输入库存报警下限数")
                return
            }
            if(maxAmount==""){
                alert("请输入库存报警上限数")
                return
            }
            if(maxCapacityAmount==""){
                alert("请输入最大存储量")
                return
            }
            let parms=$("#storage_addCell_form").serialize()
            $.post("/storage/cell/addSecurityConfiguration",parms,function (res){
                if(res){
                    window.location="storage_unmake_security_configuration_listUI"
                }
            })
        })
    })
</script>
</body>
</html>